package edu.ccut.saturn.studio.dialog.logicdialog;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.dialogs.TitleAreaDialog;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ComboBoxCellEditor;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TextCellEditor;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseTrackAdapter;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.Text;
import org.w3c.dom.Document;

import edu.ccut.saturn.studio.Activator;
import edu.ccut.saturn.studio.Images;
import edu.ccut.saturn.studio.core.search.SaturnFileSearcher.SearchResult;
import edu.ccut.saturn.studio.core.search.dialog.OneCompontentSearchDialog;
import edu.ccut.saturn.studio.core.util.eclipse.Messages;
import edu.ccut.saturn.studio.core.util.eclipse.SaturnValidation;
import edu.ccut.saturn.studio.dialog.MyCellModifierParameterForLogic;
import edu.ccut.saturn.studio.dialog.ParentPrimaryDialogForAddLogic;
import edu.ccut.saturn.studio.dialog.ParentPrimaryDialogForEditLogic;
import edu.ccut.saturn.studio.dialog.SelectionCandidate;
import edu.ccut.saturn.studio.dialog.TableViewerContentProvider;
import edu.ccut.saturn.studio.dialog.TableViewerLableProvider;
import edu.ccut.saturn.studio.logic.model.saturn.SaturnParameter;
import edu.ccut.saturn.studio.logic.model.saturn.logic.SaturnLogicInLogic;
import edu.ccut.saturn.studio.util.ConversionUtil;

public class SaturnLogicDialogInLogic extends TitleAreaDialog {

	private Text idText;
	private TableViewer tableViewer;

	private Table table;

	private Text nameText, expressionText, descriptionText;

	private Label nameLabel, expressionLabel, descriptionLabel,
			transactionTypeLabel, browser;

	private Combo transactionTypeCombo;

	private Button addButton, editButton, deleteButton, upButton, downButton;

	private List<SaturnParameter> parameterlist = new ArrayList<SaturnParameter>();

	private Shell shell;

	private SaturnLogicInLogic saturnLogicInLogic;

	public SaturnLogicDialogInLogic(Shell parentShell,
			SaturnLogicInLogic saturnLogicInLogic) {
		super(parentShell);
		this.shell = parentShell;
		this.saturnLogicInLogic = saturnLogicInLogic;
		this.setParameterList(saturnLogicInLogic.getParameters());
	}

	protected Control createContents(Composite parent) {
		Control contents = super.createContents(parent);
		setMessage(SelectionCandidate.SETTING_ATTRIBUTE
				+ saturnLogicInLogic.getName());
		return contents;
	}

	@Override
	protected Control createDialogArea(Composite parent) {

		getShell().setText(SelectionCandidate.ATTRIBUTE_SETTING);
		setTitleImage(Activator.getImage(Images.SATURN_ICONS_MAXNAME));

		Composite area = (Composite) super.createDialogArea(parent);
		Composite container = new Composite(area, SWT.NONE);

		final GridLayout gridLayout = new GridLayout();
		gridLayout.numColumns = 3;
		container.setLayout(gridLayout);
		container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

		final Label label = new Label(container, SWT.NONE);
		label.setText(Messages.getString("SaturnLogicDialogInLogic.ID")); //$NON-NLS-1$

		idText = new Text(container, SWT.READ_ONLY | SWT.BORDER);
		idText.setTextLimit(50);
		final GridData gd_idText = new GridData(SWT.FILL, SWT.FILL, true, false);
		gd_idText.verticalIndent = 10;
		gd_idText.horizontalIndent = 10;
		gd_idText.widthHint = 517;
		idText.setLayoutData(gd_idText);
		new Label(container, SWT.NONE);

		nameLabel = new Label(container, SWT.NONE);
		final GridData gd_nameLabel = new GridData();
		gd_nameLabel.verticalIndent = 10;
		nameLabel.setLayoutData(gd_nameLabel);
		nameLabel.setText(Messages.getString("SaturnLogicDialogInLogic.name")); //$NON-NLS-1$

		nameText = new Text(container, SWT.BORDER);
		nameText.setTextLimit(50);

		final GridData gd_nameText = new GridData(SWT.FILL, SWT.FILL, true,
				false);
		gd_nameText.verticalIndent = 10;
		gd_nameText.horizontalIndent = 10;
		gd_nameText.widthHint = 517;
		nameText.setLayoutData(gd_nameText);

		new Label(container, SWT.NONE);

		expressionLabel = new Label(container, SWT.NONE);
		final GridData gd_expressionLabel = new GridData();
		gd_expressionLabel.verticalIndent = 10;
		expressionLabel.setLayoutData(gd_expressionLabel);
		expressionLabel.setText(Messages
				.getString("SaturnLogicDialogInLogic.expression")); //$NON-NLS-1$

		expressionText = new Text(container, SWT.BORDER);
		expressionText.setTextLimit(150);

		final GridData gd_expressionText = new GridData(SWT.FILL, SWT.CENTER,
				true, false);
		gd_expressionText.verticalIndent = 10;
		gd_expressionText.horizontalIndent = 10;
		expressionText.setLayoutData(gd_expressionText);

		browser = new Label(container, SWT.NONE);
		browser.setImage(Activator.getImage(Images.AMPLIFY_PLUS));
		browser.addMouseListener(new MouseAdapter() {
			@SuppressWarnings("unchecked")
			public void mouseDown(final MouseEvent e) {
				OneCompontentSearchDialog dialog1 = new OneCompontentSearchDialog(
						shell, saturnLogicInLogic);
				dialog1.setTitle(Messages
						.getString("SaturnLogicDialogInLogic.ChooseKeyValue")); //$NON-NLS-1$
				if (dialog1.open() == Window.OK) {
					SearchResult result = (SearchResult) dialog1
							.getFirstResult();
					expressionText.setText(result.getKey());

					Document doc = result.getDocument();
					List<SaturnParameter> temp = saturnLogicInLogic
							.getListParameter(doc);

					if (temp == null) {
						temp = new ArrayList();
					}

					tableViewer.setInput(temp);
					parameterlist = temp;
				}
			}
		});
		browser.addMouseTrackListener(new MouseTrackAdapter() {
			public void mouseEnter(final MouseEvent e) {
				browser.setImage(Activator.getImage(Images.AMPLIFY_MINUS));
			}

			public void mouseExit(final MouseEvent e) {
				browser.setImage(Activator.getImage(Images.AMPLIFY_PLUS));
			}
		});
		final GridData gd_browser = new GridData();
		gd_browser.verticalIndent = 10;
		browser.setLayoutData(gd_browser);

		descriptionLabel = new Label(container, SWT.NONE);
		final GridData gd_descriptionLabel = new GridData(SWT.LEFT, SWT.TOP,
				false, false);
		gd_descriptionLabel.verticalIndent = 14;
		descriptionLabel.setLayoutData(gd_descriptionLabel);
		descriptionLabel.setText(Messages
				.getString("SaturnLogicDialogInLogic.description")); //$NON-NLS-1$

		descriptionText = new Text(container, SWT.V_SCROLL | SWT.BORDER);
		descriptionText.setTextLimit(200);
		final GridData gd_descriptionText = new GridData(SWT.FILL, SWT.FILL,
				true, false, 2, 1);
		gd_descriptionText.heightHint = 53;
		gd_descriptionText.verticalIndent = 10;
		gd_descriptionText.horizontalIndent = 10;
		descriptionText.setLayoutData(gd_descriptionText);

		transactionTypeLabel = new Label(container, SWT.WRAP);
		final GridData gd_transactionTypeLabel = new GridData(60, SWT.DEFAULT);
		gd_transactionTypeLabel.verticalIndent = 14;
		transactionTypeLabel.setLayoutData(gd_transactionTypeLabel);
		transactionTypeLabel.setText(Messages
				.getString("SaturnLogicDialogInLogic.TransactionType")); //$NON-NLS-1$
		transactionTypeLabel.pack();

		transactionTypeCombo = new Combo(container, SWT.READ_ONLY);
		final GridData gd_transactionTypeCombo = new GridData(SWT.FILL,
				SWT.CENTER, true, false, 2, 1);
		gd_transactionTypeCombo.verticalIndent = 10;
		gd_transactionTypeCombo.horizontalIndent = 10;
		transactionTypeCombo.setLayoutData(gd_transactionTypeCombo);
		transactionTypeCombo
				.setItems(SelectionCandidate.transactionTypesForLogic);
		transactionTypeCombo.select(0);

		final Group group = new Group(container, SWT.NONE);
		group.setLayout(new FormLayout());
		group.setText(Messages
				.getString("SaturnLogicDialogInLogic.ParaDicision")); //$NON-NLS-1$
		final GridData gd_group = new GridData(SWT.FILL, SWT.FILL, true, true,
				3, 1);
		gd_group.widthHint = 612;
		gd_group.heightHint = 161;
		gd_group.horizontalIndent = 3;
		gd_group.verticalIndent = 10;
		group.setLayoutData(gd_group);

		tableViewer = new TableViewer(group, SWT.BORDER | SWT.MULTI
				| SWT.FULL_SELECTION);
		table = tableViewer.getTable();
		final FormData fd_table = new FormData();
		fd_table.right = new FormAttachment(0, 575);
		fd_table.bottom = new FormAttachment(0, 173);
		fd_table.top = new FormAttachment(0, 10);
		fd_table.left = new FormAttachment(0, 10);
		table.setLayoutData(fd_table);
		table.setLinesVisible(true);
		table.setHeaderVisible(true);

		tableViewer.setContentProvider(new TableViewerContentProvider());
		tableViewer.setLabelProvider(new TableViewerLableProvider());

		tableViewer.setColumnProperties(new String[] { "id", "valueKey",
				"name", "classType", "passingType", "scope", "description" });

		CellEditor[] cellEditor = new CellEditor[7];
		cellEditor[0] = null;
		cellEditor[1] = new TextCellEditor(tableViewer.getTable());
		cellEditor[2] = new TextCellEditor(tableViewer.getTable());
		cellEditor[3] = new ComboBoxCellEditor(tableViewer.getTable(),
				SelectionCandidate.classtypes, SWT.READ_ONLY);
		cellEditor[4] = new ComboBoxCellEditor(tableViewer.getTable(),
				SelectionCandidate.passingTypes, SWT.READ_ONLY);
		cellEditor[5] = new ComboBoxCellEditor(tableViewer.getTable(),
				SelectionCandidate.scopesLogic, SWT.READ_ONLY);
		cellEditor[6] = new TextCellEditor(tableViewer.getTable());

		tableViewer.setCellEditors(cellEditor);
		tableViewer.setCellModifier(new MyCellModifierParameterForLogic(
				tableViewer));

		final TableColumn IDColumn = new TableColumn(table, SWT.NONE);
		IDColumn.setWidth(60);
		IDColumn.setText(Messages.getString("SaturnLogicDialogInLogic.ParaID")); //$NON-NLS-1$

		final TableColumn expressionColumn = new TableColumn(table, SWT.NONE);
		expressionColumn.setWidth(90);
		expressionColumn.setText(Messages
				.getString("SaturnLogicDialogInLogic.Expression")); //$NON-NLS-1$

		final TableColumn nameColumn = new TableColumn(table, SWT.NONE);
		nameColumn.setWidth(90);
		nameColumn.setText(Messages
				.getString("SaturnLogicDialogInLogic.ParaName")); //$NON-NLS-1$

		final TableColumn classTypeColumn = new TableColumn(table, SWT.NONE);
		classTypeColumn.setWidth(100);
		classTypeColumn.setText(Messages
				.getString("SaturnLogicDialogInLogic.ParaType")); //$NON-NLS-1$

		final TableColumn passingTypeColumn = new TableColumn(table, SWT.NONE);
		passingTypeColumn.setWidth(85);
		passingTypeColumn.setText(Messages
				.getString("SaturnLogicDialogInLogic.InputOutput")); //$NON-NLS-1$

		final TableColumn scopeColumn = new TableColumn(table, SWT.NONE);
		scopeColumn.setWidth(75);
		scopeColumn.setText(Messages
				.getString("SaturnLogicDialogInLogic.DataDomain")); //$NON-NLS-1$

		final TableColumn descriptionColumn = new TableColumn(table, SWT.NONE);
		descriptionColumn.setWidth(170);
		descriptionColumn.setText(Messages
				.getString("SaturnLogicDialogInLogic.Description")); //$NON-NLS-1$

		addButton = new Button(group, SWT.NONE);
		addButton.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(final SelectionEvent e) {
				openAddDialog();
			}
		});
		final FormData fd_addButton = new FormData();
		fd_addButton.top = new FormAttachment(table, 0, SWT.TOP);
		fd_addButton.left = new FormAttachment(table, 10, SWT.RIGHT);
		fd_addButton.right = new FormAttachment(100, -10);
		addButton.setLayoutData(fd_addButton);
		addButton.setText(SelectionCandidate.ADD_BUTTON);

		editButton = new Button(group, SWT.NONE);
		editButton.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(final SelectionEvent e) {
				IStructuredSelection selection = (IStructuredSelection) tableViewer
						.getSelection();

				if (selection.isEmpty()) {
					MessageDialog.openInformation(null,
							SelectionCandidate.HINT,
							SelectionCandidate.CHOOSE_EDIT_RECORD);
				} else {
					openEditorDialog();
				}
			}
		});
		final FormData fd_editButton = new FormData();
		fd_editButton.top = new FormAttachment(addButton, 5, SWT.BOTTOM);
		fd_editButton.left = new FormAttachment(addButton, 0, SWT.LEFT);
		fd_editButton.right = new FormAttachment(addButton, 0, SWT.RIGHT);
		editButton.setLayoutData(fd_editButton);
		editButton.setText(SelectionCandidate.EDIT_BUTTON);

		deleteButton = new Button(group, SWT.NONE);
		deleteButton.addSelectionListener(new SelectionAdapter() {
			@SuppressWarnings("unchecked")
			public void widgetSelected(SelectionEvent event) {
				IStructuredSelection selection = (IStructuredSelection) tableViewer
						.getSelection();
				SaturnParameter parameter = (SaturnParameter) selection
						.getFirstElement();

				if (selection.isEmpty()) {
					MessageDialog.openInformation(null,
							SelectionCandidate.HINT,
							SelectionCandidate.CHOOSE_DELETE_RECORD);
				} else {
					List<SaturnParameter> parameterVolist = (List<SaturnParameter>) tableViewer
							.getInput();
					parameterVolist.remove(parameter);
					ConversionUtil.reorder(parameterVolist);
					tableViewer.remove(parameter);
					tableViewer.setInput(parameterVolist);
				}
			}
		});
		final FormData fd_deleteButton = new FormData();
		fd_deleteButton.top = new FormAttachment(editButton, 5, SWT.BOTTOM);
		fd_deleteButton.left = new FormAttachment(editButton, 0, SWT.LEFT);
		fd_deleteButton.right = new FormAttachment(editButton, 0, SWT.RIGHT);
		deleteButton.setLayoutData(fd_deleteButton);
		deleteButton.setText(SelectionCandidate.DELETE_BUTTON);

		upButton = new Button(group, SWT.NONE);
		upButton.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(final SelectionEvent e) {
				IStructuredSelection selection = (IStructuredSelection) tableViewer
						.getSelection();
				if (selection.isEmpty()) {
					MessageDialog.openInformation(null,
							SelectionCandidate.HINT,
							SelectionCandidate.CHOOSE_A_RECORD);
				} else {
					Table table = tableViewer.getTable();
					if (tableViewer.getTable() != null) {
						int i = table.getSelectionIndex();
						if (i > 0) {
							SaturnParameter tps = parameterlist.get(i);
							List<?> parameterVolist = (List<?>) tableViewer
									.getInput();
							parameterVolist.remove(tps);
							parameterlist.get(i - 1).setId(
									""
											+ (Integer.valueOf(parameterlist
													.get(i - 1).getId()) + 1));
							tableViewer.remove(tps);
							tps.setId("" + (Integer.valueOf(tps.getId()) - 1));
							parameterlist.add(i - 1, tps);
							tableViewer.setInput(parameterVolist);
							table.setSelection(i - 1);
						}
					}
				}
			}
		});
		final FormData fd_upButton = new FormData();
		fd_upButton.top = new FormAttachment(deleteButton, 5, SWT.BOTTOM);
		fd_upButton.left = new FormAttachment(deleteButton, 0, SWT.LEFT);
		fd_upButton.right = new FormAttachment(deleteButton, 0, SWT.RIGHT);
		upButton.setLayoutData(fd_upButton);
		upButton.setText(SelectionCandidate.UP_BUTTON);

		downButton = new Button(group, SWT.NONE);
		downButton.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(final SelectionEvent e) {

				IStructuredSelection selection = (IStructuredSelection) tableViewer
						.getSelection();
				if (selection.isEmpty()) {
					MessageDialog.openInformation(null,
							SelectionCandidate.HINT,
							SelectionCandidate.CHOOSE_A_RECORD);
				} else {
					Table table = tableViewer.getTable();
					if (table.getItemCount() > 1) {

						if (tableViewer.getTable() != null) {
							int i = table.getSelectionIndex();
							if (i < tableViewer.getTable().getItemCount() - 1) {
								SaturnParameter tps = parameterlist.get(i + 1);
								List<?> parameterVolist = (List<?>) tableViewer
										.getInput();
								parameterVolist.remove(tps);
								parameterlist
										.get(i)
										.setId(
												""
														+ (Integer
																.valueOf(parameterlist
																		.get(i)
																		.getId()) + 1));
								tableViewer.remove(tps);
								tps.setId(""
										+ (Integer.valueOf(tps.getId()) - 1));
								parameterlist.add(i, tps);
								tableViewer.setInput(parameterVolist);
							}
						}
					}
				}
			}
		});
		final FormData fd_downButton = new FormData();
		fd_downButton.top = new FormAttachment(upButton, 5, SWT.BOTTOM);
		fd_downButton.left = new FormAttachment(upButton, 0, SWT.LEFT);
		fd_downButton.right = new FormAttachment(upButton, 0, SWT.RIGHT);
		downButton.setLayoutData(fd_downButton);
		downButton.setText(SelectionCandidate.DOWN_BUTTON);

		/**
		 * 初始化操作
		 * 
		 */
		idText.setText(saturnLogicInLogic.getId().trim());
		nameText.setText(saturnLogicInLogic.getName().trim());
		nameText.setSelection(saturnLogicInLogic.getName().trim().length());
		descriptionText.setText(saturnLogicInLogic.getDescription().trim());
		expressionText.setText(saturnLogicInLogic.getKey().trim());
		transactionTypeCombo.setText(saturnLogicInLogic.getTransactionType()
				.trim());
		tableViewer.setInput(ConversionUtil
				.scopeMapFromXmlToSurface(parameterlist));

		nameText.addModifyListener(new ModifyListener() {
			public void modifyText(final ModifyEvent e) {
				validate();
			}
		});

		expressionText.addModifyListener(new ModifyListener() {
			public void modifyText(final ModifyEvent e) {
				validate();
			}
		});

		return area;

	}

	@Override
	protected void buttonPressed(int buttonId) {
		if (parameterlist == null) {
			return;
		}
		if (buttonId == IDialogConstants.OK_ID) {
			saturnLogicInLogic.setDescription(descriptionText.getText().trim());
			saturnLogicInLogic.setKey(expressionText.getText().trim());
			saturnLogicInLogic.setTransactionType(transactionTypeCombo.getText()
					.trim());
			ConversionUtil.scopeMap(parameterlist);
			saturnLogicInLogic.setParameters(parameterlist); // 问题出现在这里
			saturnLogicInLogic.setName(nameText.getText().trim());
		}
		super.buttonPressed(buttonId);
	}

	protected void openAddDialog() {
		ParentPrimaryDialogForAddLogic addDialog = new ParentPrimaryDialogForAddLogic(
				shell, parameterlist, saturnLogicInLogic);
		addDialog.open();
		if (addDialog.getI() == 0) {
			addDialog.addList(parameterlist);
			tableViewer.setInput(parameterlist);
		}
	}

	protected void openEditorDialog() {
		ParentPrimaryDialogForEditLogic editorDialog = new ParentPrimaryDialogForEditLogic(
				shell, saturnLogicInLogic);
		SaturnParameter parameterVo = (SaturnParameter) parameterlist
				.get(tableViewer.getTable().getSelectionIndex());
		editorDialog.setIdstr(Integer.parseInt((parameterVo.getId())));
		editorDialog.setNamestr(parameterVo.getName());
		editorDialog.setClassTypestr(parameterVo.getClassType());
		editorDialog.setPassingTypestr(parameterVo.getPassingType());
		editorDialog.setScopestr(parameterVo.getScope());
		editorDialog.setValuekeystr(parameterVo.getValueKey());
		editorDialog.setDescriptionstr(parameterVo.getDescription());
		editorDialog.setValidates(parameterVo.getValidates());
		editorDialog.setIsValidate(parameterVo.getIsValidate());
		editorDialog.open();
		if (editorDialog.getI() == 1) {
			parameterVo.setName(editorDialog.getNamestr());
			parameterVo.setClassType(editorDialog.getClassTypestr());
			parameterVo.setPassingType(editorDialog.getPassingTypestr());
			parameterVo.setScope(editorDialog.getScopestr());
			parameterVo.setValueKey(editorDialog.getValuekeystr());
			parameterVo.setDescription(editorDialog.getDescriptionstr());
			parameterVo.setValidates(editorDialog.getValidates());
			parameterVo.setIsValidate(editorDialog.getIsValidate());
			tableViewer.setInput(parameterlist);
			tableViewer.refresh();
		}
	}

	private boolean validate() {

		String name = nameText.getText().trim();
		String expression = expressionText.getText().trim();
		if (SaturnValidation.isEmpty(name)) {
			setErrorMessage(Messages
					.getString("SaturnLogicDialogInLogic.NameIsEmpty")); //$NON-NLS-1$
			getButton(IDialogConstants.OK_ID).setEnabled(false);
			return false;
		}

		if (SaturnValidation.isEmpty(expression)) {
			setErrorMessage(Messages
					.getString("SaturnLogicDialogInLogic.ExpressionIsEmpty")); //$NON-NLS-1$
			getButton(IDialogConstants.OK_ID).setEnabled(false);
			return false;
		}

		getButton(IDialogConstants.OK_ID).setEnabled(true);
		setErrorMessage(null);
		return true;
	}

	@Override
	protected Point getInitialSize() {
		return new Point(680, 540);
	}

	protected int getShellStyle() {
		return SWT.CLOSE | SWT.RESIZE;
	}

	protected void configureShell(Shell newShell) {
		super.configureShell(newShell);
		newShell.setImage(Activator.getImage(Images.SATURN_ICONS_SMALLNAME));
	}

	@Override
	protected void createButtonsForButtonBar(Composite parent) {
		super.createButtonsForButtonBar(parent);
		getButton(IDialogConstants.OK_ID).setEnabled(true);
	}

	protected void setParameterList(List<SaturnParameter> parameterlist) {
		List<SaturnParameter> showParameterlist = new ArrayList<SaturnParameter>();

		for (SaturnParameter parameter : parameterlist) {
			showParameterlist.add(new SaturnParameter(parameter));
		}

		this.parameterlist = showParameterlist;
	}
}
